<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
  class Stack {

    arr = []

    push(val) {
      this.arr.push(val)
    }

    pop() {
      return this.arr.pop()
    }

    top() {
      return this.arr[this.arr.length - 1]
    }
  }
</script>
</body>
</html>